Change in openvpn[master]: Allow the TLS session to send out TLS alerts
A message that is not in the archive (sent off-list or not yet received): gerrit.1700479678000.I0ad48915004ddee587e97c8ed190ba8ee989e48d@...2715...
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/449?usp=email
to review the following change.
Change subject: Allow the TLS session to send out TLS alerts
......................................................................
Allow the TLS session to send out TLS alerts
Previous OpenVPN versions shut down the TLS control channel immediately when encountering an error. This also meant that we would not send out TLS alerts to notify a client about potential problems like mismatching TLS versions or having no common cipher.
This commit adds a new key_state S_ERROR_PRE which still allows to send out the remaining TLS packets of the control session which are typically the alert message and then going to S_ERROR. We do not wait for retries. So this is more a one-shot notify but that is acceptable in this situation.
Sending out alerts is a slight compromise in security as alerts give out a bit of information that otherwise is not given
out. But since all other consumers TLS implementation are already doing this and TLS implementation (nowadays) are very careful not to leak (sensitive) information by alerts and since the user experience is much better with alerts, this compromise is worth it.
Change-Id: I0ad48915004ddee587e97c8ed190ba8ee989e48d
---
M Changes.rst
M src/openvpn/ssl.c
M src/openvpn/ssl_backend.h
M src/openvpn/ssl_common.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_openssl.c
6 files changed, 98 insertions(+), 18 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/49/449/1
Changes.rst +11 -0
@@ -1,5 +1,16 @@ Overview of changes in 2.7 ========================== +New features +------------ +TLS alerts + OpenVPN 2.7 will send out TLS alerts to peer informing them if the TLS + session shuts down or when the TLS implementation informs the peer about + an error in the TLS session (e.g. mismatching TLS versions). This improves + the user experience as the client shows an error instead of running into + a timeout when the server just stop responding completely. + +Deprecated features +------------------- ``secret`` support has been removed by default. static key mode (non-TLS) is no longer considered "good and secure enough" for today's requirements. Use TLS mode instead. If deploying a PKI CA
src/openvpn/ssl.c +62 -17
130 lines not on this page · raw message
src/openvpn/ssl_backend.h +7 -0
@@ -372,6 +372,13 @@ const struct tls_root_ctx *ssl_ctx, bool is_server, struct tls_session *session);/** +* Sets a TLS session to be shutdown state, so the TLS library will generate +* a shutdown altert. +*/ +void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl); + +/** * Free the SSL channel part of the given key state. * * @param ks_ssl The SSL channel's state info to free
src/openvpn/ssl_common.h +4 -1
@@ -74,7 +74,10 @@* * @{ */ -#define S_ERROR -1/**< Error state. */ +#define S_ERROR (-2)/**< Error state. */ +#define S_ERROR_PRE (-1)/**< Error state but try to send out alerts +* before killing the keystore and moving +* it to S_ERROR */ #define S_UNDEF 0/**< Undefined state, used after a \c * key_state is cleaned up. */ #define S_INITIAL 1/**< Initial \c key_state state after
src/openvpn/ssl_mbedtls.c +8 -0
@@ -1275,6 +1275,14 @@ ssl_bio_read, NULL); } + +void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl) +{ +mbedtls_ssl_send_alert_message (ks_ssl->ctx,MBEDTLS_SSL_ALERT_LEVEL_FATAL , +MBEDTLS_SSL_ALERT_MSG_CLOSE_NOTIFY ); +} +void key_state_ssl_free (struct key_state_ssl *ks_ssl) {
src/openvpn/ssl_openssl.c +6 -0
@@ -1961,6 +1961,12 @@ }void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl) +{ +SSL_set_shutdown (ks_ssl->ssl,SSL_SENT_SHUTDOWN |SSL_RECEIVED_SHUTDOWN ); +} + +void key_state_ssl_free (struct key_state_ssl *ks_ssl) {if (ks_ssl->ssl)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/449?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0ad48915004ddee587e97c8ed190ba8ee989e48d
Gerrit-Change-Number: 449
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/449?usp=email )
Change subject: Allow the TLS session to send out TLS alerts
......................................................................
Patch Set 1: Code-Review-2
(9 comments)
Commit Message:
http://gerrit.openvpn.net/c/openvpn/+/449/comment/ce9fb57d_f01b1b19 :
PS1, Line 20: Sending out alerts is a slight compromise in security as alerts give superfluous space
http://gerrit.openvpn.net/c/openvpn/+/449/comment/8bf6026e_889913be :
PS1, Line 22: out. But since all other consumers TLS implementation are already doing this "consumer TLS implementations"
http://gerrit.openvpn.net/c/openvpn/+/449/comment/a80886c0_b6d5627c :
PS1, Line 23: and TLS implementation (nowadays) are very careful not to leak (sensitive) "implementations"
Patchset:
PS1:
Can't judge the state machine patch really. But the doubts about the shutdown function makes this a NAK either way.
File Changes.rst:
http://gerrit.openvpn.net/c/openvpn/+/449/comment/9c3faa2e_d4fd7ba3 :
PS1, Line 6: OpenVPN 2.7 will send out TLS alerts to peer informing them if the TLS
"peers"
http://gerrit.openvpn.net/c/openvpn/+/449/comment/fd295cc6_2def6a9b :
PS1, Line 10: a timeout when the server just stop responding completely.
"stops"
File src/openvpn/ssl.c:
http://gerrit.openvpn.net/c/openvpn/+/449/comment/38284760_a524bebe :
PS1, Line 2846: * Shut down an SSL session, so an SSL close notify is sent if there no other "there is"
http://gerrit.openvpn.net/c/openvpn/+/449/comment/8e4b3e48_338f6a18 :
PS1, Line 2851: do_ssl_shutdown(struct key_state *ks)
Why do we need an empty function? Was this supposed to call key_state_ssl_shutdown?
File src/openvpn/ssl_backend.h:
http://gerrit.openvpn.net/c/openvpn/+/449/comment/fa6d4de4_e2eda72e :
PS1, Line 376: * a shutdown altert.
alert
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/449?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0ad48915004ddee587e97c8ed190ba8ee989e48d
Gerrit-Change-Number: 449
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Mon, 20 Nov 2023 11:55:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld.
plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/449?usp=email )
Change subject: Allow the TLS session to send out TLS alerts
......................................................................
Patch Set 1:
(8 comments)
Commit Message:
http://gerrit.openvpn.net/c/openvpn/+/449/comment/e66f6133_04b1cc5d :
PS1, Line 20: Sending out alerts is a slight compromise in security as alerts give
Quoted 1 line
superfluous space
Done
http://gerrit.openvpn.net/c/openvpn/+/449/comment/d04c679a_cc1ae3ed :
PS1, Line 22: out. But since all other consumers TLS implementation are already doing this
Quoted 1 line
"consumer TLS implementations"
Done
http://gerrit.openvpn.net/c/openvpn/+/449/comment/8660b029_d3b05646 :
PS1, Line 23: and TLS implementation (nowadays) are very careful not to leak (sensitive)
Quoted 1 line
"implementations"
Done
File Changes.rst:
http://gerrit.openvpn.net/c/openvpn/+/449/comment/9f072ad8_eab0e86f :
PS1, Line 6: OpenVPN 2.7 will send out TLS alerts to peer informing them if the TLS
Quoted 1 line
"peers"
Done
http://gerrit.openvpn.net/c/openvpn/+/449/comment/568b8456_4669a9a3 :
PS1, Line 10: a timeout when the server just stop responding completely.
Quoted 1 line
"stops"
Done
File src/openvpn/ssl.c:
http://gerrit.openvpn.net/c/openvpn/+/449/comment/a39b7fdf_e1dbd71f :
PS1, Line 2846: * Shut down an SSL session, so an SSL close notify is sent if there no other
Quoted 1 line
"there is"
Done
http://gerrit.openvpn.net/c/openvpn/+/449/comment/8e57006f_630e475d :
PS1, Line 2851: do_ssl_shutdown(struct key_state *ks)
Quoted 1 line
Why do we need an empty function? Was this supposed to call
key_state_ssl_shutdown?
Yes. That is accidentally leftover code from an earlier version. I decided on the key_state_ssl_shutdown name as that aligns more with similar functions in existing code
File src/openvpn/ssl_backend.h:
http://gerrit.openvpn.net/c/openvpn/+/449/comment/6cfd1f28_022bf406 :
PS1, Line 376: * a shutdown altert.
Quoted 1 line
alert
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/449?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0ad48915004ddee587e97c8ed190ba8ee989e48d
Gerrit-Change-Number: 449
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 20 Nov 2023 13:02:18 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/449?usp=email
to look at the new patch set (#2).
Change subject: Allow the TLS session to send out TLS alerts
......................................................................
Allow the TLS session to send out TLS alerts
Previous OpenVPN versions shut down the TLS control channel immediately when encountering an error. This also meant that we would not send out TLS alerts to notify a client about potential problems like mismatching TLS versions or having no common cipher.
This commit adds a new key_state S_ERROR_PRE which still allows to send out the remaining TLS packets of the control session which are typically the alert message and then going to S_ERROR. We do not wait for retries. So this is more a one-shot notify but that is acceptable in this situation.
Sending out alerts is a slight compromise in security as alerts give out a bit of information that otherwise is not given
out. But since all other consumers TLS implementations are already doing this and TLS implementations (nowadays) are very careful not to leak (sensitive) information by alerts and since the user experience is much better with alerts, this compromise is worth it.
Change-Id: I0ad48915004ddee587e97c8ed190ba8ee989e48d
---
M Changes.rst
M src/openvpn/ssl.c
M src/openvpn/ssl_backend.h
M src/openvpn/ssl_common.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_openssl.c
6 files changed, 87 insertions(+), 18 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/49/449/2
Changes.rst +11 -0
@@ -1,5 +1,16 @@ Overview of changes in 2.7 ========================== +New features +------------ +TLS alerts + OpenVPN 2.7 will send out TLS alerts to peers informing them if the TLS + session shuts down or when the TLS implementation informs the peer about + an error in the TLS session (e.g. mismatching TLS versions). This improves + the user experience as the client shows an error instead of running into + a timeout when the server just stops responding completely. + +Deprecated features +------------------- ``secret`` support has been removed by default. static key mode (non-TLS) is no longer considered "good and secure enough" for today's requirements. Use TLS mode instead. If deploying a PKI CA
src/openvpn/ssl.c +51 -17
119 lines not on this page · raw message
src/openvpn/ssl_backend.h +7 -0
@@ -372,6 +372,13 @@ const struct tls_root_ctx *ssl_ctx, bool is_server, struct tls_session *session);/** +* Sets a TLS session to be shutdown state, so the TLS library will generate +* a shutdown alert. +*/ +void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl); + +/** * Free the SSL channel part of the given key state. * * @param ks_ssl The SSL channel's state info to free
src/openvpn/ssl_common.h +4 -1
@@ -74,7 +74,10 @@* * @{ */ -#define S_ERROR -1/**< Error state. */ +#define S_ERROR (-2)/**< Error state. */ +#define S_ERROR_PRE (-1)/**< Error state but try to send out alerts +* before killing the keystore and moving +* it to S_ERROR */ #define S_UNDEF 0/**< Undefined state, used after a \c * key_state is cleaned up. */ #define S_INITIAL 1/**< Initial \c key_state state after
src/openvpn/ssl_mbedtls.c +8 -0
@@ -1275,6 +1275,14 @@ ssl_bio_read, NULL); } + +void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl) +{ +mbedtls_ssl_send_alert_message (ks_ssl->ctx,MBEDTLS_SSL_ALERT_LEVEL_FATAL , +MBEDTLS_SSL_ALERT_MSG_CLOSE_NOTIFY ); +} +void key_state_ssl_free (struct key_state_ssl *ks_ssl) {
src/openvpn/ssl_openssl.c +6 -0
@@ -1961,6 +1961,12 @@ }void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl) +{ +SSL_set_shutdown (ks_ssl->ssl,SSL_SENT_SHUTDOWN |SSL_RECEIVED_SHUTDOWN ); +} + +void key_state_ssl_free (struct key_state_ssl *ks_ssl) {if (ks_ssl->ssl)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/449?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0ad48915004ddee587e97c8ed190ba8ee989e48d
Gerrit-Change-Number: 449
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/449?usp=email )
Change subject: Allow the TLS session to send out TLS alerts
......................................................................
Patch Set 2: Code-Review+1
(1 comment)
Patchset:
PS2:
My concerns have been addressed, but state machine needs further review.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/449?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0ad48915004ddee587e97c8ed190ba8ee989e48d
Gerrit-Change-Number: 449
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Mon, 20 Nov 2023 13:08:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, plaisthos.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/449?usp=email
to look at the new patch set (#3).
The following approvals got outdated and were removed:
Code-Review+1 by flichtenheld
Change subject: Allow the TLS session to send out TLS alerts
......................................................................
Allow the TLS session to send out TLS alerts
Previous OpenVPN versions shut down the TLS control channel immediately when encountering an error. This also meant that we would not send out TLS alerts to notify a client about potential problems like mismatching TLS versions or having no common cipher.
This commit adds a new key_state S_ERROR_PRE which still allows to send out the remaining TLS packets of the control session which are typically the alert message and then going to S_ERROR. We do not wait for retries. So this is more a one-shot notify but that is acceptable in this situation.
Sending out alerts is a slight compromise in security as alerts give out a bit of information that otherwise is not given
out. But since all other consumers TLS implementations are already doing this and TLS implementations (nowadays) are very careful not to leak (sensitive) information by alerts and since the user experience is much better with alerts, this compromise is worth it.
Change-Id: I0ad48915004ddee587e97c8ed190ba8ee989e48d
---
M Changes.rst
M src/openvpn/ssl.c
M src/openvpn/ssl_backend.h
M src/openvpn/ssl_common.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_openssl.c
6 files changed, 88 insertions(+), 18 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/49/449/3
Changes.rst +11 -0
@@ -1,5 +1,16 @@ Overview of changes in 2.7 ========================== +New features +------------ +TLS alerts + OpenVPN 2.7 will send out TLS alerts to peers informing them if the TLS + session shuts down or when the TLS implementation informs the peer about + an error in the TLS session (e.g. mismatching TLS versions). This improves + the user experience as the client shows an error instead of running into + a timeout when the server just stops responding completely. + +Deprecated features +------------------- ``secret`` support has been removed by default. static key mode (non-TLS) is no longer considered "good and secure enough" for today's requirements. Use TLS mode instead. If deploying a PKI CA
src/openvpn/ssl.c +52 -17
120 lines not on this page · raw message
src/openvpn/ssl_backend.h +7 -0
@@ -372,6 +372,13 @@ const struct tls_root_ctx *ssl_ctx, bool is_server, struct tls_session *session);/** +* Sets a TLS session to be shutdown state, so the TLS library will generate +* a shutdown alert. +*/ +void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl); + +/** * Free the SSL channel part of the given key state. * * @param ks_ssl The SSL channel's state info to free
src/openvpn/ssl_common.h +4 -1
@@ -74,7 +74,10 @@* * @{ */ -#define S_ERROR -1/**< Error state. */ +#define S_ERROR (-2)/**< Error state. */ +#define S_ERROR_PRE (-1)/**< Error state but try to send out alerts +* before killing the keystore and moving +* it to S_ERROR */ #define S_UNDEF 0/**< Undefined state, used after a \c * key_state is cleaned up. */ #define S_INITIAL 1/**< Initial \c key_state state after
src/openvpn/ssl_mbedtls.c +8 -0
@@ -1275,6 +1275,14 @@ ssl_bio_read, NULL); } + +void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl) +{ +mbedtls_ssl_send_alert_message (ks_ssl->ctx,MBEDTLS_SSL_ALERT_LEVEL_FATAL , +MBEDTLS_SSL_ALERT_MSG_CLOSE_NOTIFY ); +} +void key_state_ssl_free (struct key_state_ssl *ks_ssl) {
src/openvpn/ssl_openssl.c +6 -0
@@ -1961,6 +1961,12 @@ }void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl) +{ +SSL_set_shutdown (ks_ssl->ssl,SSL_SENT_SHUTDOWN |SSL_RECEIVED_SHUTDOWN ); +} + +void key_state_ssl_free (struct key_state_ssl *ks_ssl) {if (ks_ssl->ssl)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/449?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0ad48915004ddee587e97c8ed190ba8ee989e48d
Gerrit-Change-Number: 449
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld, plaisthos.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/449?usp=email
to look at the new patch set (#4).
Change subject: Allow the TLS session to send out TLS alerts
......................................................................
Allow the TLS session to send out TLS alerts
Previous OpenVPN versions shut down the TLS control channel immediately when encountering an error. This also meant that we would not send out TLS alerts to notify a client about potential problems like mismatching TLS versions or having no common cipher.
This commit adds a new key_state S_ERROR_PRE which still allows to send out the remaining TLS packets of the control session which are typically the alert message and then going to S_ERROR. We do not wait for retries. So this is more a one-shot notify but that is acceptable in this situation.
Sending out alerts is a slight compromise in security as alerts give out a bit of information that otherwise is not given
out. But since all other consumers TLS implementations are already doing this and TLS implementations (nowadays) are very careful not to leak (sensitive) information by alerts and since the user experience is much better with alerts, this compromise is worth it.
Change-Id: I0ad48915004ddee587e97c8ed190ba8ee989e48d
---
M Changes.rst
M src/openvpn/ssl.c
M src/openvpn/ssl_backend.h
M src/openvpn/ssl_common.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_openssl.c
6 files changed, 89 insertions(+), 19 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/49/449/4
Changes.rst +11 -0
@@ -1,5 +1,16 @@ Overview of changes in 2.7 ========================== +New features +------------ +TLS alerts + OpenVPN 2.7 will send out TLS alerts to peers informing them if the TLS + session shuts down or when the TLS implementation informs the peer about + an error in the TLS session (e.g. mismatching TLS versions). This improves + the user experience as the client shows an error instead of running into + a timeout when the server just stops responding completely. + +Deprecated features +------------------- ``secret`` support has been removed by default. static key mode (non-TLS) is no longer considered "good and secure enough" for today's requirements. Use TLS mode instead. If deploying a PKI CA
src/openvpn/ssl.c +53 -18
128 lines not on this page · raw message
src/openvpn/ssl_backend.h +7 -0
@@ -372,6 +372,13 @@ const struct tls_root_ctx *ssl_ctx, bool is_server, struct tls_session *session);/** +* Sets a TLS session to be shutdown state, so the TLS library will generate +* a shutdown alert. +*/ +void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl); + +/** * Free the SSL channel part of the given key state. * * @param ks_ssl The SSL channel's state info to free
src/openvpn/ssl_common.h +4 -1
@@ -74,7 +74,10 @@* * @{ */ -#define S_ERROR -1/**< Error state. */ +#define S_ERROR (-2)/**< Error state. */ +#define S_ERROR_PRE (-1)/**< Error state but try to send out alerts +* before killing the keystore and moving +* it to S_ERROR */ #define S_UNDEF 0/**< Undefined state, used after a \c * key_state is cleaned up. */ #define S_INITIAL 1/**< Initial \c key_state state after
src/openvpn/ssl_mbedtls.c +8 -0
@@ -1275,6 +1275,14 @@ ssl_bio_read, NULL); } + +void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl) +{ +mbedtls_ssl_send_alert_message (ks_ssl->ctx,MBEDTLS_SSL_ALERT_LEVEL_FATAL , +MBEDTLS_SSL_ALERT_MSG_CLOSE_NOTIFY ); +} +void key_state_ssl_free (struct key_state_ssl *ks_ssl) {
src/openvpn/ssl_openssl.c +6 -0
@@ -1961,6 +1961,12 @@ }void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl) +{ +SSL_set_shutdown (ks_ssl->ssl,SSL_SENT_SHUTDOWN |SSL_RECEIVED_SHUTDOWN ); +} + +void key_state_ssl_free (struct key_state_ssl *ks_ssl) {if (ks_ssl->ssl)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/449?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0ad48915004ddee587e97c8ed190ba8ee989e48d
Gerrit-Change-Number: 449
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld, plaisthos.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/449?usp=email
to look at the new patch set (#5).
Change subject: Allow the TLS session to send out TLS alerts
......................................................................
Allow the TLS session to send out TLS alerts
Previous OpenVPN versions shut down the TLS control channel immediately when encountering an error. This also meant that we would not send out TLS alerts to notify a client about potential problems like mismatching TLS versions or having no common cipher.
This commit adds a new key_state S_ERROR_PRE which still allows to send out the remaining TLS packets of the control session which are typically the alert message and then going to S_ERROR. We do not wait for retries. So this is more a one-shot notify but that is acceptable in this situation.
Sending out alerts is a slight compromise in security as alerts give out a bit of information that otherwise is not given
out. But since all other consumers TLS implementations are already doing this and TLS implementations (nowadays) are very careful not to leak (sensitive) information by alerts and since the user experience is much better with alerts, this compromise is worth it.
Change-Id: I0ad48915004ddee587e97c8ed190ba8ee989e48d
---
M Changes.rst
M src/openvpn/ssl.c
M src/openvpn/ssl_backend.h
M src/openvpn/ssl_common.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_openssl.c
6 files changed, 89 insertions(+), 19 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/49/449/5
Changes.rst +11 -0
@@ -1,5 +1,16 @@ Overview of changes in 2.7 ========================== +New features +------------ +TLS alerts + OpenVPN 2.7 will send out TLS alerts to peers informing them if the TLS + session shuts down or when the TLS implementation informs the peer about + an error in the TLS session (e.g. mismatching TLS versions). This improves + the user experience as the client shows an error instead of running into + a timeout when the server just stops responding completely. + +Deprecated features +------------------- ``secret`` support has been removed by default. static key mode (non-TLS) is no longer considered "good and secure enough" for today's requirements. Use TLS mode instead. If deploying a PKI CA
src/openvpn/ssl.c +53 -18
128 lines not on this page · raw message
src/openvpn/ssl_backend.h +7 -0
@@ -372,6 +372,13 @@ const struct tls_root_ctx *ssl_ctx, bool is_server, struct tls_session *session);/** +* Sets a TLS session to be shutdown state, so the TLS library will generate +* a shutdown alert. +*/ +void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl); + +/** * Free the SSL channel part of the given key state. * * @param ks_ssl The SSL channel's state info to free
src/openvpn/ssl_common.h +4 -1
@@ -74,7 +74,10 @@* * @{ */ -#define S_ERROR -1/**< Error state. */ +#define S_ERROR (-2)/**< Error state. */ +#define S_ERROR_PRE (-1)/**< Error state but try to send out alerts +* before killing the keystore and moving +* it to S_ERROR */ #define S_UNDEF 0/**< Undefined state, used after a \c * key_state is cleaned up. */ #define S_INITIAL 1/**< Initial \c key_state state after
src/openvpn/ssl_mbedtls.c +8 -0
@@ -1275,6 +1275,14 @@ ssl_bio_read, NULL); } + +void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl) +{ +mbedtls_ssl_send_alert_message (ks_ssl->ctx,MBEDTLS_SSL_ALERT_LEVEL_FATAL , +MBEDTLS_SSL_ALERT_MSG_CLOSE_NOTIFY ); +} +void key_state_ssl_free (struct key_state_ssl *ks_ssl) {
src/openvpn/ssl_openssl.c +6 -0
@@ -1961,6 +1961,12 @@ }void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl) +{ +SSL_set_shutdown (ks_ssl->ssl,SSL_SENT_SHUTDOWN |SSL_RECEIVED_SHUTDOWN ); +} + +void key_state_ssl_free (struct key_state_ssl *ks_ssl) {if (ks_ssl->ssl)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/449?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0ad48915004ddee587e97c8ed190ba8ee989e48d
Gerrit-Change-Number: 449
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/449?usp=email )
Change subject: Allow the TLS session to send out TLS alerts
......................................................................
Patch Set 5:
(1 comment)
Patchset:
PS5:
Note: currently not reviewing due to the open build failure
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/449?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0ad48915004ddee587e97c8ed190ba8ee989e48d
Gerrit-Change-Number: 449
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Tue, 28 Nov 2023 13:35:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: plaisthos.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/449?usp=email
to look at the new patch set (#6).
Change subject: Allow the TLS session to send out TLS alerts
......................................................................
Allow the TLS session to send out TLS alerts
Previous OpenVPN versions shut down the TLS control channel immediately when encountering an error. This also meant that we would not send out TLS alerts to notify a client about potential problems like mismatching TLS versions or having no common cipher.
This commit adds a new key_state S_ERROR_PRE which still allows to send out the remaining TLS packets of the control session which are typically the alert message and then going to S_ERROR. We do not wait for retries. So this is more a one-shot notify but that is acceptable in this situation.
Sending out alerts is a slight compromise in security as alerts give out a bit of information that otherwise is not given
out. But since all other consumers TLS implementations are already doing this and TLS implementations (nowadays) are very careful not to leak (sensitive) information by alerts and since the user experience is much better with alerts, this compromise is worth it.
---
M Changes.rst
M src/openvpn/ssl.c
M src/openvpn/ssl_backend.h
M src/openvpn/ssl_common.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_openssl.c
6 files changed, 87 insertions(+), 19 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/49/449/6
Changes.rst +9 -0
@@ -1,5 +1,14 @@ Overview of changes in 2.7 ========================== +New features +------------ +TLS alerts + OpenVPN 2.7 will send out TLS alerts to peers informing them if the TLS + session shuts down or when the TLS implementation informs the peer about + an error in the TLS session (e.g. mismatching TLS versions). This improves + the user experience as the client shows an error instead of running into + a timeout when the server just stops responding completely. + Deprecated features ------------------- ``secret`` support has been removed by default.
src/openvpn/ssl.c +53 -18
128 lines not on this page · raw message
src/openvpn/ssl_backend.h +7 -0
@@ -363,6 +363,13 @@ const struct tls_root_ctx *ssl_ctx, bool is_server, struct tls_session *session);/** +* Sets a TLS session to be shutdown state, so the TLS library will generate +* a shutdown alert. +*/ +void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl); + +/** * Free the SSL channel part of the given key state. * * @param ks_ssl The SSL channel's state info to free
src/openvpn/ssl_common.h +4 -1
@@ -74,7 +74,10 @@* * @{ */ -#define S_ERROR -1/**< Error state. */ +#define S_ERROR (-2)/**< Error state. */ +#define S_ERROR_PRE (-1)/**< Error state but try to send out alerts +* before killing the keystore and moving +* it to S_ERROR */ #define S_UNDEF 0/**< Undefined state, used after a \c * key_state is cleaned up. */ #define S_INITIAL 1/**< Initial \c key_state state after
src/openvpn/ssl_mbedtls.c +8 -0
@@ -1276,6 +1276,14 @@ ssl_bio_read, NULL); } + +void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl) +{ +mbedtls_ssl_send_alert_message (ks_ssl->ctx,MBEDTLS_SSL_ALERT_LEVEL_FATAL , +MBEDTLS_SSL_ALERT_MSG_CLOSE_NOTIFY ); +} +void key_state_ssl_free (struct key_state_ssl *ks_ssl) {
src/openvpn/ssl_openssl.c +6 -0
@@ -1962,6 +1962,12 @@ }void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl) +{ +SSL_set_shutdown (ks_ssl->ssl,SSL_SENT_SHUTDOWN |SSL_RECEIVED_SHUTDOWN ); +} + +void key_state_ssl_free (struct key_state_ssl *ks_ssl) {if (ks_ssl->ssl)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/449?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0ad48915004ddee587e97c8ed190ba8ee989e48d
Gerrit-Change-Number: 449
Gerrit-PatchSet: 6
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/449?usp=email )
Change subject: Allow the TLS session to send out TLS alerts
......................................................................
Patch Set 6: Code-Review+2
(2 comments)
Patchset:
PS6:
Looks good to me, but did not test it.
File src/openvpn/ssl.c:
http://gerrit.openvpn.net/c/openvpn/+/449/comment/46b395cc_6e433008 :
PS6, Line 3236: msg(D_TLS_ERRORS, "TLS Error: generate_key_expansion failed");
While here, can we fix the error message, please?
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/449?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0ad48915004ddee587e97c8ed190ba8ee989e48d
Gerrit-Change-Number: 449
Gerrit-PatchSet: 6
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Mon, 18 Mar 2024 16:30:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH v6 1/1 Allow the TLS session to send out TLS alerts
In reply to a message not in the archiveFrom: Arne Schwabe <[email protected]...>
Previous OpenVPN versions shut down the TLS control channel immediately when encountering an error. This also meant that we would not send out TLS alerts to notify a client about potential problems like mismatching TLS versions or having no common cipher.
This commit adds a new key_state S_ERROR_PRE which still allows to send out the remaining TLS packets of the control session which are typically the alert message and then going to S_ERROR. We do not wait for retries. So this is more a one-shot notify but that is acceptable in this situation.
Sending out alerts is a slight compromise in security as alerts give out a bit of information that otherwise is not given
out. But since all other consumers TLS implementations are already doing this and TLS implementations (nowadays) are very careful not to leak (sensitive) information by alerts and since the user experience is much better with alerts, this compromise is worth it.
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/449
This mail reflects revision 6 of this Change.
Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]...>
Changes.rst +9 -0
@@ -1,5 +1,14 @@ Overview of changes in 2.7 ========================== +New features +------------ +TLS alerts + OpenVPN 2.7 will send out TLS alerts to peers informing them if the TLS + session shuts down or when the TLS implementation informs the peer about + an error in the TLS session (e.g. mismatching TLS versions). This improves + the user experience as the client shows an error instead of running into + a timeout when the server just stops responding completely. + Deprecated features ------------------- ``secret`` support has been removed by default.
src/openvpn/ssl.c +53 -18
128 lines not on this page · raw message
src/openvpn/ssl_backend.h +7 -0
@@ -363,6 +363,13 @@ const struct tls_root_ctx *ssl_ctx, bool is_server, struct tls_session *session);/** +* Sets a TLS session to be shutdown state, so the TLS library will generate +* a shutdown alert. +*/ +void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl); + +/** * Free the SSL channel part of the given key state. * * @param ks_ssl The SSL channel's state info to free
src/openvpn/ssl_common.h +4 -1
@@ -74,7 +74,10 @@* * @{ */ -#define S_ERROR -1/**< Error state. */ +#define S_ERROR (-2)/**< Error state. */ +#define S_ERROR_PRE (-1)/**< Error state but try to send out alerts +* before killing the keystore and moving +* it to S_ERROR */ #define S_UNDEF 0/**< Undefined state, used after a \c * key_state is cleaned up. */ #define S_INITIAL 1/**< Initial \c key_state state after
src/openvpn/ssl_mbedtls.c +8 -0
@@ -1276,6 +1276,14 @@ ssl_bio_read, NULL); } + +void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl) +{ +mbedtls_ssl_send_alert_message (ks_ssl->ctx,MBEDTLS_SSL_ALERT_LEVEL_FATAL , +MBEDTLS_SSL_ALERT_MSG_CLOSE_NOTIFY ); +} +void key_state_ssl_free (struct key_state_ssl *ks_ssl) {
src/openvpn/ssl_openssl.c +6 -0
@@ -1962,6 +1962,12 @@ }void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl) +{ +SSL_set_shutdown (ks_ssl->ssl,SSL_SENT_SHUTDOWN |SSL_RECEIVED_SHUTDOWN ); +} + +void key_state_ssl_free (struct key_state_ssl *ks_ssl) {if (ks_ssl->ssl)
[Openvpn-devel] [PATCH applied] Re: Allow the TLS session to send out TLS alerts
Took me a bit to find a setup where this made a difference, but with CA / fingerprint validation errors on the client, I saw
tlsv1 alert unknown ca
on the server, and with a "tls-version-min/max" mismatch (server requiring 1.1, client capped to 1.0) I saw a proper error on the client
2024-06-01 22:18:57 Received fatal SSL alert: protocol version 2024-06-01 22:18:57 OpenSSL: error:0A00042E:SSL routines::tlsv1 alert protocol version:SSL alert number 70 2024-06-01 22:18:57 TLS_ERROR: BIO read tls_read_plaintext error
.. while "without the patch" (older server) it would just sit there and timeout, never hearing anything back from the server. Haven't tried variants more likely to occur in practice (especially "client cert expired") but expect this to be a useful addition to troubleshooting.
An older client connecting to a patched server will receive the alerts perfectly fine (as expected, no code changes in those paths), but obviously won't send them *out* - even though visible in the client log.
2024-06-01 22:25:25 Sent fatal SSL alert: unknown CA
For completeness, sent through the server side threadmill (testing with the full set of 2.2 to master clients), and also through GHA - all works. Great :-)
Your patch has been applied to the master branch.
commit fbe3b49b373ea8e81aaa31a383258403a3bfcd07
Author: Arne Schwabe Date: Mon Apr 8 14:49:33 2024 +0200
Allow the TLS session to send out TLS alerts
Signed-off-by: Arne Schwabe <[email protected]...>
Acked-by: Frank Lichtenheld <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg28540.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#7) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/449?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld
Change subject: Allow the TLS session to send out TLS alerts
......................................................................
Allow the TLS session to send out TLS alerts
Previous OpenVPN versions shut down the TLS control channel immediately when encountering an error. This also meant that we would not send out TLS alerts to notify a client about potential problems like mismatching TLS versions or having no common cipher.
This commit adds a new key_state S_ERROR_PRE which still allows to send out the remaining TLS packets of the control session which are typically the alert message and then going to S_ERROR. We do not wait for retries. So this is more a one-shot notify but that is acceptable in this situation.
Sending out alerts is a slight compromise in security as alerts give out a bit of information that otherwise is not given
out. But since all other consumers TLS implementations are already doing this and TLS implementations (nowadays) are very careful not to leak (sensitive) information by alerts and since the user experience is much better with alerts, this compromise is worth it.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg28540.html
---
M Changes.rst
M src/openvpn/ssl.c
M src/openvpn/ssl_backend.h
M src/openvpn/ssl_common.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_openssl.c
6 files changed, 87 insertions(+), 19 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/49/449/7
Changes.rst +9 -0
@@ -1,5 +1,14 @@ Overview of changes in 2.7 ========================== +New features +------------ +TLS alerts + OpenVPN 2.7 will send out TLS alerts to peers informing them if the TLS + session shuts down or when the TLS implementation informs the peer about + an error in the TLS session (e.g. mismatching TLS versions). This improves + the user experience as the client shows an error instead of running into + a timeout when the server just stops responding completely. + Deprecated features ------------------- ``secret`` support has been removed by default.
src/openvpn/ssl.c +53 -18
128 lines not on this page · raw message
src/openvpn/ssl_backend.h +7 -0
@@ -363,6 +363,13 @@ const struct tls_root_ctx *ssl_ctx, bool is_server, struct tls_session *session);/** +* Sets a TLS session to be shutdown state, so the TLS library will generate +* a shutdown alert. +*/ +void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl); + +/** * Free the SSL channel part of the given key state. * * @param ks_ssl The SSL channel's state info to free
src/openvpn/ssl_common.h +4 -1
@@ -74,7 +74,10 @@* * @{ */ -#define S_ERROR -1/**< Error state. */ +#define S_ERROR (-2)/**< Error state. */ +#define S_ERROR_PRE (-1)/**< Error state but try to send out alerts +* before killing the keystore and moving +* it to S_ERROR */ #define S_UNDEF 0/**< Undefined state, used after a \c * key_state is cleaned up. */ #define S_INITIAL 1/**< Initial \c key_state state after
src/openvpn/ssl_mbedtls.c +8 -0
@@ -1276,6 +1276,14 @@ ssl_bio_read, NULL); } + +void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl) +{ +mbedtls_ssl_send_alert_message (ks_ssl->ctx,MBEDTLS_SSL_ALERT_LEVEL_FATAL , +MBEDTLS_SSL_ALERT_MSG_CLOSE_NOTIFY ); +} +void key_state_ssl_free (struct key_state_ssl *ks_ssl) {
src/openvpn/ssl_openssl.c +6 -0
@@ -1941,6 +1941,12 @@ }void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl) +{ +SSL_set_shutdown (ks_ssl->ssl,SSL_SENT_SHUTDOWN |SSL_RECEIVED_SHUTDOWN ); +} + +void key_state_ssl_free (struct key_state_ssl *ks_ssl) {if (ks_ssl->ssl)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/449?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0ad48915004ddee587e97c8ed190ba8ee989e48d
Gerrit-Change-Number: 449
Gerrit-PatchSet: 7
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/449?usp=email )
Change subject: Allow the TLS session to send out TLS alerts
......................................................................
Allow the TLS session to send out TLS alerts
Previous OpenVPN versions shut down the TLS control channel immediately when encountering an error. This also meant that we would not send out TLS alerts to notify a client about potential problems like mismatching TLS versions or having no common cipher.
This commit adds a new key_state S_ERROR_PRE which still allows to send out the remaining TLS packets of the control session which are typically the alert message and then going to S_ERROR. We do not wait for retries. So this is more a one-shot notify but that is acceptable in this situation.
Sending out alerts is a slight compromise in security as alerts give out a bit of information that otherwise is not given
out. But since all other consumers TLS implementations are already doing this and TLS implementations (nowadays) are very careful not to leak (sensitive) information by alerts and since the user experience is much better with alerts, this compromise is worth it.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg28540.html
---
M Changes.rst
M src/openvpn/ssl.c
M src/openvpn/ssl_backend.h
M src/openvpn/ssl_common.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_openssl.c
6 files changed, 87 insertions(+), 19 deletions(-)
Changes.rst +9 -0
@@ -1,5 +1,14 @@ Overview of changes in 2.7 ========================== +New features +------------ +TLS alerts + OpenVPN 2.7 will send out TLS alerts to peers informing them if the TLS + session shuts down or when the TLS implementation informs the peer about + an error in the TLS session (e.g. mismatching TLS versions). This improves + the user experience as the client shows an error instead of running into + a timeout when the server just stops responding completely. + Deprecated features ------------------- ``secret`` support has been removed by default.
src/openvpn/ssl.c +53 -18
128 lines not on this page · raw message
src/openvpn/ssl_backend.h +7 -0
@@ -363,6 +363,13 @@ const struct tls_root_ctx *ssl_ctx, bool is_server, struct tls_session *session);/** +* Sets a TLS session to be shutdown state, so the TLS library will generate +* a shutdown alert. +*/ +void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl); + +/** * Free the SSL channel part of the given key state. * * @param ks_ssl The SSL channel's state info to free
src/openvpn/ssl_common.h +4 -1
@@ -74,7 +74,10 @@* * @{ */ -#define S_ERROR -1/**< Error state. */ +#define S_ERROR (-2)/**< Error state. */ +#define S_ERROR_PRE (-1)/**< Error state but try to send out alerts +* before killing the keystore and moving +* it to S_ERROR */ #define S_UNDEF 0/**< Undefined state, used after a \c * key_state is cleaned up. */ #define S_INITIAL 1/**< Initial \c key_state state after
src/openvpn/ssl_mbedtls.c +8 -0
@@ -1276,6 +1276,14 @@ ssl_bio_read, NULL); } + +void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl) +{ +mbedtls_ssl_send_alert_message (ks_ssl->ctx,MBEDTLS_SSL_ALERT_LEVEL_FATAL , +MBEDTLS_SSL_ALERT_MSG_CLOSE_NOTIFY ); +} +void key_state_ssl_free (struct key_state_ssl *ks_ssl) {
src/openvpn/ssl_openssl.c +6 -0
@@ -1941,6 +1941,12 @@ }void +key_state_ssl_shutdown (struct key_state_ssl *ks_ssl) +{ +SSL_set_shutdown (ks_ssl->ssl,SSL_SENT_SHUTDOWN |SSL_RECEIVED_SHUTDOWN ); +} + +void key_state_ssl_free (struct key_state_ssl *ks_ssl) {if (ks_ssl->ssl)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/449?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0ad48915004ddee587e97c8ed190ba8ee989e48d
Gerrit-Change-Number: 449
Gerrit-PatchSet: 7
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged